<?php
 Session_Start () ;
 Include ("../include/garennes.cfg") ;
 Include ("../include/init.php") ;
 Include ("../inclus/config.inc") ;
 $id_etablissement = var_courante ("id", 0, NULL) ;
 $base = var_courante ("base", 0, NULL) ;
 If (IsSet ($base))
  {
   $base_choisie = $base ;
   SQL_selection_bd ($base, $id_sql) ;
   $_SESSION ["bdd_sql"] = $base ;
  }
 $cahier_textes_id = $_SESSION ["cahier_textes_id"] ;
 If ($cahier_textes_id != 0) { $id = cahier_textes_id_etablissement ($cahier_textes_id) ; }
 Elseif (IsSet ($id_etablissement)) { $id = $id_etablissement ; } Else { $id = 0 ; }
 If ($id != 0)
  {
   $millesime = millesime (0) ;
   $ok = SQL_commande ("SELECT cahier_textes,cahier_public FROM etablissements WHERE id_etablissement='".$id."' AND millesime='".$millesime."' LIMIT 1", $id_sql) ;
   If (SQL_nbr_lignes ($ok) == 1)
    {
     $ligne = SQL_ligne_suivante ($ok) ;
     If (($ligne [0] == 1) And ($ligne [1] > 0))
      {
       Echo "<html><head><link rel=\"shortint icon\" href=\"../images/icone.ico\"><title>".$titre_page_principale."</title>" ;
       Include ("./include/accueil.js") ;
       Echo "</head>" ;
       Echo "<frameset rows=\"60,*\" frameborder=\"0\" border=\"0\">" ;
       Echo "<frameset cols=\"160,*\" frameborder=\"0\" border=\"0\">" ;
       Echo "<frame src=\"./pages/logo.php?id=".$id."\" name=\"logo\" noresize scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\">" ;
       Echo "<frame src=\"./pages/menu.php?id=".$id."\" name=\"menu\" marginheight=\"0\" marginwidth=\"0\">" ;
       Echo "</frameset>" ;
       If ((integer)$cahier_textes_id > 0)
        {
         Echo "<frame src=\"./pages/cahier_textes.php?id=".$id."&id_classe=".$cahier_textes_id."\" name=\"status\" noresize scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\">" ;
        }
       Else
        {
         Echo "<frame src=\"./pages/status.php?id=".$id."\" name=\"status\" noresize scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\">" ;
        }
       Echo "</frameset>" ;
       Echo "</html>" ;
       Exit ;
      }
    }
  }
 Header ("location: ../index.php") ;
?>